import React, { Suspense } from 'react';
import './index.css';
import routes from './router/index'
import { HashRouter, Route, Routes } from 'react-router-dom';
import { AuthProvider } from './AuthContext'

function App() {
  return (
    <AuthProvider>
      <HashRouter>
        <Suspense fallback={<div>loading....</div>}>
          <Routes>
            {
              routes.map((route, idnex) => (
                <Route
                  key={idnex}
                  path={route.path}
                  element={route.element}
                ></Route>
              ))
            }
          </Routes>
        </Suspense>
      </HashRouter>
    </AuthProvider>

  );
}

export default App;
